﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GdHotel.Data.Interfaces;
using GdHotel.Data.Repositories;
using GdHotel.Web.Attributes;
using GdHotel.Web.Models;
using UniqueTechnologies.Attributes;
using UniqueTechnologies.Data.Interfaces;

namespace GdHotel.Web.Controllers
{
    [LayoutSupport]
    [LanguageSupport]
    public class AboutController : BaseUiController
    {
        private const String AboutKey = "about";
        private const String LocationKey = "location";

        public override ILanguagesRepository LanguagesRepository { get; set; }
        public override INotesRepository NotesRepository { get; set; }
        public override IMainMenuItemsRepository MainMenuItemsRepository { get; set; }
        public override IAdditionalMenuItemsRepository AdditionalMenuItemsRepository { get; set; }
        public ICustomPagesRepository CustomPagesRepository { get; set; }
        public IGalleriesRepository GalleriesRepository { get; set; }

        public AboutController(ILanguagesRepository languagesRepository, INotesRepository notesRepository, IMainMenuItemsRepository mainMenuItemsRepository, IAdditionalMenuItemsRepository additionalMenuItemsRepository, ICustomPagesRepository customPagesRepository, IGalleriesRepository galleriesRepository)
        {
            LanguagesRepository = languagesRepository;
            NotesRepository = notesRepository;
            MainMenuItemsRepository = mainMenuItemsRepository;
            AdditionalMenuItemsRepository = additionalMenuItemsRepository;
            CustomPagesRepository = customPagesRepository;
            GalleriesRepository = galleriesRepository;
        }

        //
        // GET: /About/

        public ActionResult Index()
        {
            var page = CustomPagesRepository.FindAllByLangAndKey(Language, AboutKey).FirstOrDefault();
            var gallery = GalleriesRepository.FindAllByKey("common").FirstOrDefault();
            var model = new ShowModel {Page = page, PageGallery = gallery};
            return View(model);
        }

        //
        // GET: /About/

        public ActionResult Location()
        {
            var page = CustomPagesRepository.FindAllByLangAndKey(Language, LocationKey).FirstOrDefault();
            var gallery = GalleriesRepository.FindAllByKey("common").FirstOrDefault();
            var model = new ShowModel { Page = page, PageGallery = gallery };
            return View(model);
        }
    }
}
 